/**
 * 
 */
package handwritten.character;

import handwritten.gesture.Gesture;
import handwritten.gesture.MultiGesture;

import java.util.ArrayList;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import utility.math.Vector2D;

/**
 * @author tioz
 *
 */

@XmlRootElement (
	    name = "##default", 
	    namespace = "##default" 
	)

@XmlType (
	    name = "##default", 
	    propOrder = {""}, 
	    namespace = "##default" 
	    //factoryClass = DEFAULT.class, 
	    //factoryMethod = ""
	)
public class RawHandWrittenCharacter implements HandWritten{

	/**
	 * 
	 */
	private String 			id;
	private MultiGesture 	gesture;
	
	public RawHandWrittenCharacter() {
		this.id = "RAW";
		gesture = new MultiGesture();
	}
	/**
	 * 
	 */
	public RawHandWrittenCharacter(String character,MultiGesture gest) {
		this.id = character;
		gesture = gest;
	}
		
	public String getId(){
		return id;
	}
	
	/**
	 * @return deep copy of the gesture
	 */
	public MultiGesture getGesture()  {
		return (MultiGesture)gesture.clone();
	}
	
	
	public String writeRepresentation(){
		
		String out = new String();
		
		int cell[][]=new int[60][60];
		
		gesture.fillPath(cell);
		
		
		for(int j=0;j< cell[0].length;j++)
		{
			for(int i=0;i< cell.length;i++)
			{
				out +=Integer.toString(cell[i][j]);
			}
			out += "\n";
		}
		
		 
		return out;
	}
	
		
	
	

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((gesture == null) ? 0 : gesture.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RawHandWrittenCharacter other = (RawHandWrittenCharacter) obj;
		if (gesture == null) {
			if (other.gesture != null)
				return false;
		} else if (!gesture.equals(other.gesture))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}
	/**
	 * @param gesture the gesture to set
	 */
	public void setGesture(MultiGesture gesture) {
		this.gesture = gesture;
	}
	/**
	 * @return
	 */
	public HandWrittenCharacter getHandwritten() {
		return new HandWrittenCharacter(id,gesture);
	}




	
	
}